home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 January / MacHome Magazine Demo Disc January 2001.iso / pc / Software / Networking / InterMapper 3.0 - PPC.sea / InterMapper 3.0 - PPC / InterMapper™ 3.0-PPC / InterMapper™ 3.0-PPC.rsrc / PrTy_161_com.dartware.tcp.ldap < prev    next >
Encoding:
Text File  |  2000-07-24  |  3.2 KB  |  126 lines

  1. <!-- 
  2.     LDAP (com.dartware.tcp.ldap)
  3.     Copyright © 2000 Dartware, LLC. All rights reserved.
  4. -->
  5.  
  6. <header>
  7.     type            =     "tcp-script"
  8.     package            =     "com.dartware"
  9.     probe_name        =    "tcp.ldap"
  10.     human_name        =    "LDAP"
  11.     version            =     "1.1"
  12.     address_type    =     "IP"
  13.     port_number        =    "389"
  14.     
  15.     old_protocol    =     "8"            # Backward compat. with old numbering scheme.
  16.     old_script        =     "8201"
  17.  
  18. </header>
  19.  
  20. <description>
  21.  
  22. ≤GB≥Lightweight Directory Access Protocol (LDAP)≤P≥
  23.  
  24. The protocol used to access directories supporting the X.500 models, as described in RFC 2251.
  25.  
  26. </description>
  27.  
  28. <parameters>
  29.  
  30. "Bind Name"                = "o=Dartmouth College,c=US"
  31. "Name to Lookup"        = "Bill Fisher"
  32.  
  33. </parameters>
  34.  
  35. <script>
  36.  
  37. CONN #60 (connect timeout in seconds)
  38. WAIT #30 @IDLE (idle timeout in seconds)
  39. DISC @DISCONNECT (disconnect handler)
  40. LINE BER
  41.  
  42. -- All LDAP messages have the following structure envelope:
  43. --
  44. --    LDAPMessage ::= SEQUENCE {
  45. --        messageID       INTEGER( 0..2^31-1),
  46. --        protocolOp      CHOICE {
  47. --            bindRequest     BindRequest,
  48. --            bindResponse    BindResponse,
  49. --            unbindRequest   UnbindRequest,
  50. --            searchRequest   SearchRequest,
  51. --            searchResEntry  SearchResultEntry,
  52. --            searchResDone   SearchResultDone,
  53. --            searchResRef    SearchResultReference,
  54. --            ...
  55. --        }
  56. --        controls       [0] Controls OPTIONAL
  57. --    }
  58. --
  59. -- This script never includes the optional controls field in its LDAP messages.
  60.  
  61.  
  62. -- Send bindRequest PDU and expect a bindResponse PDU answer:
  63. --
  64. --    BindRequest ::= [APPLICATION 0] SEQUENCE {
  65. --        version        INTEGER (1 .. 127),
  66. --        name           OCTET STRING,
  67. --        authentication [PRIVATE 0] OCTET STRING
  68. --    }
  69. --
  70.  
  71. BSND { #1, [60]{ #3, "${Bind Name}", [80]""} }
  72. BRCV { #1, [61]{ [0A]#ENUM, "", "" } } else @PARSE_ERROR
  73. NBNE #${ENUM} #0 @CHECK_VERSION
  74.  
  75. -- Send a searchRequest
  76. @SEND_SEARCH:
  77. BSND { #2, [63]{ "${Bind Name}", [0A]#2, [0A]#3, #0, #60, [01]#0, [A3]{ "cn", "${Name to Lookup}"}, {}  }}
  78.  
  79. STOR "COUNT" "0"
  80. @PARSE_REPLY:
  81. BRCV { #2, ["TAG"]{ ... } } else @PARSE_ERROR
  82. NBNE #${TAG} #100 else @NOT_RES_ENTRY
  83. BRCV { #2, [64]{ "C", { {"X",[31]{ "Y" }},... } } } else @PARSE_ERROR
  84. NADD "COUNT" #1
  85. NEXT
  86. GOTO @PARSE_REPLY
  87.  
  88. @NOT_RES_ENTRY:
  89. NBNE #${TAG} #101 @NOT_RES_END
  90. DONE OKAY "[LDAP] Found ${COUNT} matches for \"${Name to Lookup}\""
  91.  
  92. @NOT_RES_END:
  93. DONE ALRM "[LDAP] Unexpected response: ${TAG}"
  94.  
  95.  
  96. -- Error Handlers --
  97.  
  98. @CHECK_VERSION:
  99. NBNE #${ENUM} #2 else @BAD_BIND_RESPONSE
  100. BSND { #1, [60]{ #2, "${Bind Name}", [80]""} }
  101. BRCV { #1, [61]{ [0A]#ENUM, "", "" } } else @PARSE_ERROR
  102. NBNE #${ENUM} #0 @BAD_BIND_RESPONSE
  103. GOTO @SEND_SEARCH
  104.  
  105. @BAD_BIND_RESPONSE:
  106. NBNE #${ENUM} #1 else @+2
  107. DONE WARN "[LDAP] Response to Bind Request = operationsError (1)"
  108. NBNE #${ENUM} #2 else @+2
  109. DONE WARN "[LDAP] Response to Bind Request = protocolError (2)"
  110. NBNE #${ENUM} #48 else @+2
  111. DONE WARN "[LDAP] Response to Bind Request = inappropriateAuthentication (48)"
  112. NBNE #${ENUM} #49 else @+2
  113. DONE WARN "[LDAP] Response to Bind Request = invalidCredentials (49)"
  114. DONE WARN "[LDAP] Response to Bind Request = ${ENUM}"
  115.  
  116. @PARSE_ERROR:
  117. DONE ALRM "[LDAP] Error parsing response from the server. [Line ${_IDLELINE}]"
  118.  
  119. @IDLE:
  120. DONE ALRM "[LDAP] No data for ${_IDLETIMEOUT} seconds. [Line ${_IDLELINE}]"
  121.  
  122. @DISCONNECT:
  123. DONE DOWN "[LDAP] Disconnected from port ${_REMOTEPORT} after ${_SECSCONNECTED} seconds."
  124.  
  125. </script>
  126.